# Contributor: Will Sinatra <wpsinatra@gmail.com>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=chez-scheme
pkgver=9.5.2
pkgrel=0
pkgdesc="Cisco R6RS Scheme Compiler"
url="https://github.com/cisco/ChezScheme"
arch="x86 x86_64" #armv7/aarch64 ports WIP
license="Apache-2.0"
makedepends="util-linux-dev ncurses-dev libx11-dev"
subpackages="$pkgname-doc"
source="https://github.com/cisco/ChezScheme/releases/download/v$pkgver/csv$pkgver.tar.gz
	remove-xlocale.patch"
builddir="$srcdir"/csv$pkgver
options="!check" #No defined checks

build() {
	case "$CARCH" in
	     x86) _host=ti3le ;;
	     x86_64) _host=ta6le ;;
	     armv7) _host=i3nt ;; #void uses arm32le, which is flagged as nonvalid
		 aarch64) _host=ta6le ;; #compiler error
	esac

	case "$CARCH" in
	     x86) conf="--threads" ;;
	     x86_64) conf="--threads" ;;
	     armv7) ;;
		 aarch64) conf="--threads" ;;
	esac

	./configure \
			--installprefix=/usr \
			--temproot=$pkgdir \
			--installschemename="chez" \
			--installscriptname="chez-script" \
			--machine=$_host \
			$conf
}

package() {
	make install DESTDIR="$pkgdir"
}

sha512sums="a2dacb8689b49365a33518522df6e8a964f15ec22945c2949c2593612139bf56a755ad269b6c955ac8fed6d6221c6b861f1b0d41a255e2715817b0024c8b9cef  csv9.5.2.tar.gz
29386e6990a4adefcb1bbe7289a27b94dd8d225f2dbcbb1c704ca973263025083a70737a38fa2c815d12036980481b6614d3a332eb05caab2063259896e5b4af  remove-xlocale.patch"
